package com.rbs.Controller;

import com.rbs.entity.Brand;
import com.rbs.service.BrandService;
import com.rbs.service.Impl.BrandServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet(urlPatterns = "/selectAllBrandController")
public class SelectAllBrandController extends HttpServlet {
    private BrandService brandService = new BrandServiceImpl();
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        List<Brand> brandList = brandService.selectAllBrand();
        //降获取到的数据放入到request作用域
        request.setAttribute("brandList",brandList);
        request.getRequestDispatcher("/showAllBrand.jsp").forward(request,response);
    }
}
